package com.nkzy.mapper;

import com.nkzy.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    //根据用户名查询用户的方法
    @Select("select * from user where username=#{username}")
    User selectUserByName(String username);
    //注册的方法
    @Insert("insert into user(username,password,create_time,update_time) values(#{username},#{password},now(),now())")
    void insert(String username,String password);


    @Select("select * from user where id=#{id}")
    User selectUserById(Integer id);
    //查询所有用户的方法，然后进行单元测试
    @Select("select * from user")
    User selectUserById01();
    //修改一个用户的姓名的方法
    @Update("update user set username=#{dong} where username=#{username}")
    void update(String username);
}
